Обновить

Transparent proxying in I2P and Tor

Время на прочтение 2 min
Количество просмотров 39K
Hi all!
I wanted to install a caching proxy based on Polipo, and at the same time set up transparent i2p and Tor proxying. Of all the services that are available in these anonymous networks (mail, torrents, etc.), I only use the web, so most likely you will not be able to use services that use a non-http protocol if you follow these instructions.
I have a home server on Debian that distributes the Internet. I used TinyProxy as a domain-based distributor, two polipo daemons - one for caching the Internet, the second for (to a greater extent) converting socks5 into an http proxy in order to register it in TinyProxy, and also caches Tor traffic separately; dnsmasq for resolving .i2p and .onion addresses (I had previously used it for both DNS and DHCP).
We will assume that I2P and Tor are already configured and working.

                I2P (4444)
                /
LAN port – TinyProxy (8888) – Polipo-WAN (8123)
                \
                Polipo-Tor (8124) - Tor (9050)


Let's get started!


dnsmasq

First, let's configure dnsmasq so that the browser can get some non-existent ip for .i2p and .onion domains
Excerpt from /etc/dnsmasq.conf:
address=/.i2p/192.168.99.99
address=/.onion/192.168.99.99


tinyproxy

Now let's configure TinyProxy. In this server, the upstream rules are executed according to the “last is first” principle, so if we put the upstream for the Internet after the upstreams for .i2p and .onion, nothing will work.
Excerpt from /etc/tinyproxy.conf:
upstream 127.0.0.1:8123
upstream 127.0.0.1:4444 ".i2p"
upstream 127.0.0.1:8124 ".onion"


Polipo

Everything is simple here. We configure Polipo for WAN to suit our tastes, but in Polipo for Tor everything is the same, we just add lines:
socksParentProxy = "localhost:9050"
socksProxyType = socks5


iptables

Probably the most important part. It won't work without it. Execute the command:
sudo iptables -t nat -I PREROUTING -i _LANETH_ -d ! 192.168.4.0/24 -p tcp --dport 80 -j REDIRECT --to-ports 8888

Where _LANETH_ — local network interface, and 192.168.4.0/24 — your local subnet.

That's all! You can browse .i2p and .onion sites without additional browser settings from any device.
Tags:
Hubs:
Всего голосов 30: ↑27 и ↓3 +24
Комментарии 18
+18

Comments 18

> That's all! You can browse .i2p and .orion sites without additional browser settings from any device.
But it is not recommended to do this, since when moving from .i2p to regular addresses, the Referrer is passed through the link, which can reveal you as an i2p user.
A UFO flew in and published this inscription here
Your nickname is suitable)
A UFO flew in and published this inscription here
Moreover, all this seems to be described in the documentation for this very i2p, you just need to read it carefully =)
A UFO flew in and published this inscription here
You just need to put haproxy instead of tinyproxy and cut everything except the Host and the request itself.
Well, or scribble it yourself in Python using gevent to make it work quickly.
TinyProxy can do all this too, I just don’t really visit unfamiliar sites in i2p, but go to certain ones.
A UFO flew in and published this inscription here
It's very bad to do that. If someone inserts a picture from the external Internet onto a hidden site, they will find out your real IP.
In principle, this is true, you just need to understand that in this case access is provided, but not anonymity.

Transparent proxying in Tor on a router would also probably be interesting to do. Packets need to be wrapped in SOCKS, plus DNS must be done somehow. DNS via Tor actually works?
And if I connect to my VPS via VPN, then how do I need to configure iptables to access i2p (it is installed and running on the VPS)?
I set it up like this on my router... Okay, my router is powerful. A dual-core processor is the only thing that saves you - i2p eats up the core completely. Java is probably the reason for this…
I have the same thing, most of all it looks like a bug in the latest versions of either i2p or Java, because at first the load is not very large, but after a while one core or a little more (15% approximately) is consumed, while acting as a “router” I have, to put it mildly, a powerful piece of hardware with an Intel e3-1240 :( The hidden network itself does not slow down any more than usual, in general it is a very strange and unpleasant thing.
No bug. Your I2P router turns into a floodfill.
Thank you, so that’s what it’s all about, it’s a pity that there is no indication of the operating mode, otherwise I was already planning to rearrange the router and the toad out of ignorance :)
And yet it was a bug :) 0.9.19 fixed:
Changes

Floodfill performance improvements


Bugs fixed

Fixes for high CPU usage in floodfills

Only full-fledged users can leave comments. Sign in, Please.